import cloneDeep from "lodash/cloneDeep.js";

export function setData(source, data) {
  const _source = cloneDeep(source);
  for (const [keyName, primaryData] of Object.entries(data)) {
    if (keyName === "personInfo") {
      _source.body.dataStores[`felder_main.${keyName}`].rowSet.primary =
        primaryData;
    } else {
      _source.body.dataStores[`felder_tcm.${keyName}`].rowSet.primary =
        primaryData;
    }
  }
  return _source;
}
export const initData = {
  header: { code: 0, message: { title: "", detail: "" } },
  body: {
    dataStores: {
      "felder_tcm.mainDataStore": {
        rowSet: {
          primary: [],
          filter: [],
          delete: [],
        },
        name: "felder_tcm.mainDataStore",
        pageNumber: 1,
        pageSize: 2147483647,
        recordCount: 1,
      },
      "felder_tcm.detailDataStore": {
        rowSet: {
          primary: [],
          filter: [],
          delete: [],
        },
        name: "felder_tcm.detailDataStore",
        pageNumber: 1,
        pageSize: 2147483647,
        recordCount: 9,
      },
      "felder_tcm.guideDataStore": {
        rowSet: {
          primary: [],
          filter: [],
          delete: [],
        },
        name: "felder_tcm.guideDataStore",
        pageNumber: 1,
        pageSize: 2147483647,
        recordCount: 6,
      },
      "felder_main.personInfo": {
        rowSet: {
          primary: [
            // {
            //   paykindcode: '2',
            //   filedate: null,
            //   isfamilyholder: '',
            //   addressprovince: '',
            //   needSetting: true,
            //   historyother: '',
            //   nationalcode: '01',
            //   creatorname: '黄艳华',
            //   cacountycode: '440112',
            //   lifeanimalhousecode: '',
            //   managedate: 1311264000000,
            //   gendercode: '2',
            //   needcancelfamily: '',
            //   opertime: 1629849825446,
            //   extParameters: {},
            //   community: '沙步社区居民委员会',
            //   enddate: null,
            //   linkcsum: '2021-08-09',
            //   workunit: '无单位',
            //   endreasoncode: '',
            //   operatorname: '麦楚君',
            //   status: '1',
            //   gender: '女',
            //   _lobproperties: [],
            //   needUpdate: false,
            //   local: '',
            //   alivecode: '1',
            //   rhcode: '3',
            //   sensitivecode: '1',
            //   managepcode: '2C0F250485D046F395120720D370C0CA',
            //   contactphone: '13660558807',
            //   managep: '黄艳华',
            //   address: '广州市黄埔区南岗街万科尚城A5-203房',
            //   linkdfc: '',
            //   chid: '2b9d977b-dc77-4375-a739-dab00271c6d8',
            //   createdtime: 1311264000000,
            //   fathername: '',
            //   streetcode: '440112008',
            //   lifewatercode: '',
            //   addressalley: '',
            //   createdunitname: '南岗街社区卫生服务中心',
            //   operunitname: '第四团队',
            //   deformityother: '',
            //   historycode: '1',
            //   lastcheckdate: null,
            //   linktelephone: '18922722779',
            //   idnumber: '440112194706240622',
            //   managedcenter: '广州市黄埔区南岗街社区卫生服务中心',
            //   stateid: '1',
            //   _notrimproperties: [],
            //   linkd: '',
            //   addressstreet: '',
            //   linkb: '',
            //   managedstationcode: '440112008003',
            //   addresshouse: '',
            //   linkl: '',
            //   sysdate: null,
            //   doorname: '',
            //   linkp: '',
            //   sensitiveother: '',
            //   linkn: '',
            //   linkadd2: '',
            //   linkadd1: '',
            //   linkch: '',
            //   linkt: '',
            //   operatorcode: 'EAB2EC1399B347A3B3195F45AFC09381',
            //   educationcode: '9',
            //   linkr: '44011200800818106',
            //   mothername: '',
            //   add2: '',
            //   alley: '',
            //   add1: '',
            //   linkw: '',
            //   operunitcode: '440112008007',
            //   needassignholder: '',
            //   paykindother: '',
            //   postcode: '',
            //   bweight: null,
            //   lifekitchencode: '',
            //   addresscity: '',
            //   creatorcode: '877',
            //   relationcode: '',
            //   inoutmark: '',
            //   linkdhr: '',
            //   cacounty: '黄埔区',
            //   cacity: '广州市',
            //   linkname: '姚文娟',
            //   alleycode: '',
            //   newfamilyholder: '',
            //   birthday: -710838000000,
            //   poveresi: '',
            //   whetherlocal: '',
            //   communitycode: '440112008008',
            //   code: '44011200800818106',
            //   homephone: '',
            //   remark: '',
            //   managedstation: '',
            //   selfname: '钟喜有',
            //   exposecode: '1',
            //   createdunitcode: '440112008000',
            //   addresscounty: '',
            //   street: '南岗街道',
            //   householdreg: '广州市黄埔区南岗街坑田新村25号（鹿中）',
            //   gestweeks: null,
            //   lifetoiletcode: '',
            //   inoutdate: null,
            //   documenttype: '01',
            //   maritalstatuscode: '2',
            //   familycode: '',
            //   lifefuelcode: '',
            //   recversion: '',
            //   caprovince: '广东省',
            //   managedcentercode: '440112008000',
            //   bloodcode: '5',
            //   profcode: '8',
            //   deformitycode: '1',
            //   livinglife: '',
            //   addresscommunity: '',
            //   age: '74',
            // },
          ],
          filter: [],
          delete: [],
        },
        name: "felder_main.personInfo",
        pageNumber: 1,
        pageSize: 10,
        recordCount: 0,
        parameters: {},
      },
    },
    parameters: {
      FH0_BUSINESS_TYPE: "12",
      FH0_MODEL_TYPE: "02",
      FH0_OPERATE_TYPE: "01",
      _IABONAME: "fhrElderIABO",
      _IABOMETHOD: "saveElderTCMOld",
      _DATASOURCE: "ph",
    },
  },
};
